package com.dizang.view;

import java.util.ArrayList;
import java.util.List;

import org.springframework.boot.CommandLineRunner;
import org.springframework.boot.autoconfigure.EnableAutoConfiguration;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;
import org.springframework.context.annotation.Configuration;
import org.springframework.context.annotation.ImportResource;

import com.alibaba.fastjson.JSON;
import com.dizang.view.entity.User;

import springfox.documentation.swagger2.annotations.EnableSwagger2;


/**
 * 
 * Title: SampleWebJspApplication 
 * Description: 
 * Company:
 * 
 * @author 蔡俊豪 cocaijunhao
 * @date 2016年9月8日
 *
 */
@Configuration
@ImportResource(value={"classpath:application-bean.xml","classpath:application-bean2.xml"})
@EnableAutoConfiguration // 本人表示，一定要有这个标签(不然，你会吃亏的)
@EnableSwagger2
@ComponentScan
public class SampleWebJspApplication extends SpringBootServletInitializer implements CommandLineRunner{

	public static void main(String[] args) throws Exception {
//		SpringApplication.run(SampleWebJspApplication.class, args);
		String string = null;
	}

	/**
	 * 如果要发布到自己的Tomcat中的时候，需要继承SpringBootServletInitializer类，并且增加如下的configure方法。
	 * 如果不发布到自己的Tomcat中的时候，就无需上述的步骤
	 */
	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder application) {
		return application.sources(SampleWebJspApplication.class);
	}

	@Override
	public void run(String... arg0) throws Exception {
		String str= "{\"name\":\"6666\"}";
		JSON json = (JSON) JSON.parse(str);
		User javaObject = json.toJavaObject(User.class);
		ArrayList<Integer> list = new ArrayList();
		list.add(1);
		list.add(2);
		list.add(3);
		List<Integer> subList = list.subList(0, 2);
		System.out.println(subList.toString());
	}
}